/*
 *
 * Created on: 22.10.2012
 *
 * hostInfo.h
 * This file is part of KOBUS
 * 
 * Copyright (C) 2012 - Ivan Penkin, MIPT
 * grek.penkin@gmail.com
 *
 * KOBUS is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * KOBUS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with KOBUS; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, 
 * Boston, MA  02110-1301  USA
 *  
 */

#ifndef HOSTINFO_H_
#define HOSTINFO_H_


#include <KobusCommon.h>
#include <QtNetwork/qhostaddress.h>


namespace kobus {

class KOBUS_COMMON_EXPORT HostInfo: public QSerializable
{
    Q_OBJECT;

    Q_PROPERTY(quint16 type      READ getType       WRITE setType);
    Q_PROPERTY(quint32 flags     READ getFlags      WRITE setFlags);
    Q_PROPERTY(quint64 id        READ getId         WRITE setId);
    Q_PROPERTY(QString iface     READ getIface      WRITE setIface);
    Q_PROPERTY(QString mac       READ getMac        WRITE setMac);
    Q_PROPERTY(QString remoteId  READ getRemoteId   WRITE setRemoteId);
    Q_PROPERTY(QString circuitId READ getCircuitId  WRITE setCircuitId);
    Q_PROPERTY(quint16 vlan      READ getVlan       WRITE setVlan);
    Q_PROPERTY(QHostAddress ip   READ getIp         WRITE setIp);

  public:
    class Types
    {
      private:
        enum PrivateType {PrivateDhcpInfo, PrivateNasInfo};

      public:
        static const quint16 DhcpInfo = PrivateDhcpInfo;
        static const quint16 NasInfo  = PrivateNasInfo;
    };


    HostInfo(QObject * parent = 0);
    HostInfo(quint16 /* type */, quint32 /* flags */,quint64 /* id */,
          const QString & /* iface */, const QString & /* mac */,
          const QString & /* remoteId */, const QString & /* circuitId */,
          quint16 /* vlan */, const QHostAddress & /* ip */,
          QObject * parent = 0);
    ~HostInfo();

    quint16 getType() const;
    quint32 getFlags() const;
    quint64 getId() const;
    const QString & getIface() const;
    const QString & getMac() const;
    const QString & getRemoteId() const;
    const QString & getCircuitId() const;
    quint16 getVlan() const;
    const QHostAddress & getIp() const;

    void setType(quint16 type);
    void setFlags(quint32 flags);
    void setId(quint64 id);
    void setIface(const QString & iface);
    void setMac(const QString & mac);
    void setRemoteId(const QString & remoteId);
    void setCircuitId(const QString & circuitId);
    void setVlan(quint16 vlan);
    void setIp(const QHostAddress & ip);

  private:
    quint16 type;
    quint32 flags;
    quint64 id;
    QString iface;
    QString mac;
    QString remoteId;
    QString circuitId;

    quint16 vlan;
    QHostAddress ip;
};

} /* namespace kobus */

#endif /* HOSTINFO_H_ */
